﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/MasterPage.master" AutoEventWireup="true"
    CodeFile="MaterilMangement.aspx.cs" Inherits="PlanMangement_PlanView" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TabTitle" runat="Server">
    <%= Resources.Resource.MaterilMangement%><%--成品半成品维护--%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <div style="width: 100%;">
        <div class="queryDiv1">
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="divFrameHead">
                       <span class="querytextCss">
                    <%= Resources.Resource.Query%><%--查询条件--%></span>
                    </td>
                </tr>
                <tr>
                    <td class="submitborder" style="padding-top: 15px; padding-bottom: 15px;">
                        <table style="margin-bottom: 10px;" width="95%" border="0" align="center" cellpadding="0"
                            cellspacing="0">
                            <tr>
                                <td class="submitborder4">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="submitFieldbg">
                                              <%= Resources.Resource.ProductID%><%--产品编号--%>
                                            </td>
                                           <td align="left">
                                                <asp:TextBox ID="txt_ProductCode" runat="server" Width="120px"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                            <td style=" width:70%">
                                            </td>
                                        </tr> 
                                    </table>
                                </td>
                            </tr>
                        </table>
                       <div style="text-align: center;">
                    <asp:Button ID="btn_Query" runat="server" Text=" <%$ Resources:Resource,btnEnquiry %> "
                        OnClick="btn_Query_Click" />&nbsp;&nbsp;<%--查 询--%>
                    <asp:Button ID="Button2" runat="server" Text=" <%$ Resources:Resource, btnAdd%> "
                        OnClientClick="return Add()" />&nbsp;&nbsp;<%--添 加--%>
                    <asp:Button ID="btn_Upload" runat="server" Text=" <%$ Resources:Resource, ResolveUpload%> "
                        OnClick="btn_Upload_Click" />&nbsp;&nbsp;<%--上传--%>
                    <asp:Button ID="btn_UnitMount" runat="server" Text=" <%$ Resources:Resource, btnUnitMount%> "
                        OnClick="btn_UnitMount_Click" Visible="false" />&nbsp;&nbsp;<%--抽取元件数--%>
                </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="GridDivCss">
            <IMC:GridView ID="gvProductView" runat="server" AllowPaging="true" AllowSorting="true"
                PageSize="10" DataSourceID="ProductDataSource" OnRowCommand="gvProductView_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, ProductID%>" ItemStyle-HorizontalAlign="Left">
                        <%--产品编号--%>
                        <ItemTemplate>
                            &nbsp;&nbsp;<asp:Label ID="lbl_xSVMaterial" runat="server" Text='<%#Eval("ProductCode")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, ComponentsNo%>" ItemStyle-HorizontalAlign="Right">
                        <%--元件数量--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbl_Plant" runat="server" Text='<%#Eval("UnitCount")%>'></asp:Label>&nbsp;&nbsp;
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, Parameter%>" ItemStyle-HorizontalAlign="Center">
                        <%--参数--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbl_Para" runat="server" Text='<%#Eval("Para")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="isTemp" ItemStyle-HorizontalAlign="Center">
                        <%--参数--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbl_isTemp" runat="server" Text='<%#Eval("isTemp")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, Operating%>" ItemStyle-HorizontalAlign="Center">
                        <%--操作--%>
                        <ItemTemplate>
                            &nbsp; <a href="#" onclick="return Upd('<%#Eval("ProductCode")%>', '<%#Eval("HalfProductCode")%>', '<%#Eval("UnitCount")%>','<%#Eval("ID")%>','<%#Eval("Para")%>','<%#Eval("ProgramName")%>','<%#Eval("Operation")%>','<%#Eval("OperationTime")%>','<%#Eval("pOperation")%>','<%#Eval("pOperationTime")%>','<%#Eval("isTemp")%>')">
                                <%= Resources.Resource.btnMaintain%></a><%--维护--%>
                            &nbsp;
                            <asp:LinkButton ID="lbtn_Del" runat="server" CommandName="Del" OnClientClick=" return isDel()"
                                CommandArgument='<%#Eval("ID")%>'><%= Resources.Resource.btnDel%></asp:LinkButton>
                            <%--删除--%>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </IMC:GridView>
            <asp:ObjectDataSource ID="ProductDataSource" runat="server" SelectMethod="Select"
                TypeName="ProductDataSource">
                <SelectParameters>
                    <asp:ControlParameter ControlID="txt_ProductCode" Name="ProductCode" PropertyName="Text"
                        Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </div>
    </div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <input id="btnPreview" runat="server" type="button" value="预览" cssclass="buttonbgtwo"
        style="display: none;" />
    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="btnPreview"
        PopupControlID="Panel1" BackgroundCssClass="modalBackground" CancelControlID="btnCancel"
        DropShadow="true" PopupDragHandleControlID="Panel3" />
    <asp:Panel ID="Panel1" runat="server" Width="650px" CssClass="modalPopup" Style="display: none">
        <asp:Panel ID="Panel3" runat="server" Style="cursor: move; background-color: #DDDDDD;
            border: solid 1px Gray; color: Black">
            <div class="tagdivhead" style="background-color: #D6E0EE; padding-top: 8px">
                <div class="divcenter">
                    Log:&nbsp;&nbsp;<asp:Label ID="txt_HalfLog" runat="server" Font-Underline="true"></asp:Label>&nbsp;                    
                </div>
            </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ModifytableCss">
                <tr>
                    <td colspan="3" style="height: 1px">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="querytexttdCss" style="width: 20%">
                        <%=Resources.Resource.ProductID%><%--产品编号--%>
                    </td>
                    <td class="querycoltdCss" style="width: 30%">
                        <asp:TextBox ID="txtM_ProductCode" runat="server" Width="120px" MaxLength="45"></asp:TextBox>
                    </td>
                    <td class="querytexttdCss" style="width: 20%">
                        <%=Resources.Resource.ComponentsNo%>
                        <%--元件数量--%>
                    </td>
                    <td class="querycoltdCss" style="width: 30%">
                        <asp:TextBox ID="txtM_UnitCount" runat="server" Width="120px" MaxLength="7"></asp:TextBox>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="<%$Resources:Resource,Number%>"
                            ControlToValidate="txtM_UnitCount" Type="Integer" MinimumValue="0" MaximumValue="999999"
                            Display="Dynamic" ValidationGroup="Upd">
                        </asp:RangeValidator>
                        <asp:HiddenField ID="hid_ID" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="querytexttdCss" style="width: 20%">
                        <%=Resources.Resource.Parameter%>
                        <%--参数--%>
                    </td>
                    <td class="querycoltdCss" style="width: 30%">
                        <asp:TextBox ID="txtM_Para" runat="server" Width="120px" MaxLength="30"></asp:TextBox>
                        <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtM_Para"
                            ValidationGroup="Upd" ErrorMessage="<%$Resources:Resource,Number%>" Type="Double"
                            Display="Dynamic"></asp:CompareValidator>
                    </td>
                    <td class="querytexttdCss">
                        isTemp
                    </td>
                    <td class="querycoltdCss">
                       <asp:CheckBox ID="cbx_isTemp" runat="server" /> 
                    </td>
                </tr>
                <tr>
                    <td class="querytexttdCss" style="width: 100px">
                        
                    </td>
                    <td class="querycoltdCss" colspan="3">
                        
                    </td>
                </tr>
                <tr style="height: 5px;">
                    <td colspan="4">
                    </td>
                </tr>
                <tr>
                    <td class="querytexttdCss" style="width: 100px">
                    </td>
                    <td class="querycoltdCss" colspan="3">
                        <%-- HalfProduct Log&nbsp;&nbsp;<asp:Label ID="txt_HalfLog" runat="server">ccc</asp:Label> --%>
                    </td>
                </tr>
                <tr>
                    <td class="querytexttdCss" style="width: 100px; height: 30px;">
                    </td>
                    <td class="querycoltdCss" colspan="3">
                        <%--Program Log&nbsp;&nbsp;<asp:Label ID="txt_ProgramLog" runat="server"></asp:Label>--%>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="padding-bottom: 3; padding-top: 3;">
                        <asp:Button ID="btn_Save" runat="server" Text="<%$Resources:Resource,btnSave%>" ValidationGroup="Upd"
                            OnClick="btn_Save_Click" />
                        <%--保 存--%>
                        &nbsp;&nbsp;&nbsp;<asp:Button ID="btnCancel" runat="server" Text="<%$Resources:Resource,btnClear%>" />
                        <%--取 消--%>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="height: 5px;">
                        &nbsp;
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </asp:Panel>
    <script type="text/javascript">
        function Add() {
            document.getElementById("<%= txtM_ProductCode.ClientID%>").value = "";
            document.getElementById("<%= cbx_isTemp.ClientID%>").checked = false;
            document.getElementById("<%= txtM_UnitCount.ClientID%>").value = "";
            document.getElementById("<%= hid_ID.ClientID%>").value = "";
            document.getElementById("<%= txtM_Para.ClientID%>").value = "1";
            document.getElementById("<%= txtM_ProductCode.ClientID%>").readOnly = "";
            document.getElementById("<%= txt_HalfLog.ClientID%>").innerText = ""; 

            document.getElementById('<%= btnPreview.ClientID%>').click();
            return false;
        }


        function Upd(ProductCode, HalfProductCode, UnitCount, ID, Para, ProgramName, hOperation, hOperationTime, pOperation, pOperationTime, isTemp) {

            document.getElementById("<%= txtM_ProductCode.ClientID%>").value = ProductCode;
            document.getElementById("<%= txtM_UnitCount.ClientID%>").value = UnitCount;
            document.getElementById("<%= txtM_Para.ClientID%>").value = Para;
            document.getElementById("<%= hid_ID.ClientID%>").value = ID;
            document.getElementById("<%= txt_HalfLog.ClientID%>").innerText = hOperation + " | " + hOperationTime;
            if (isTemp == 1) {
                document.getElementById("<%= cbx_isTemp.ClientID%>").checked = true;
            } else {
                document.getElementById("<%= cbx_isTemp.ClientID%>").checked = false;
            }
            document.getElementById("<%= txtM_ProductCode.ClientID%>").readOnly = "readOnly";

            document.getElementById('<%= btnPreview.ClientID%>').click();
            return false;

        }
        function Closed() {
            window.opener = null; window.close();
        }
        function isDel() {
            return confirm('<%=Resources.Resource.IsDelete %>');
        }
    </script>
</asp:Content>
